<%@ page language="java" import="java.util.*,java.sql.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<jsp:useBean id="db" class="connBean.ConnDB" scope="page">
</jsp:useBean>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'deleteallProduct.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
    <body>
    <%
   String  deleteids[]=request.getParameterValues("checkAll");
    int i=0;
String deleteid="";
for(i=0;i<deleteids.length;i++){
deleteid+=deleteids[i];
if(i!=deleteids.length-1) deleteid+="','";
}
db.OpenConn();
db.createStmt();

 String sql="delete from Product where p_id in('"+deleteid+"'"+")";//定义插入SQL语句
 System.out.println();
 System.out.print(sql);
 int result=db.Update(sql);//执行SQL语句
 if(result!=0){ 
%>  删除成功，等待2秒后返回。<% 
response.setHeader("Refresh","5;URL=selectproduct.jsp");//执行插入成功跳转
 }else{
 %>  删除失败，等待2秒后返回。<% 
response.setHeader("Refresh","5;URL=selectproduct.jsp");//执行插入失败跳转
 }
    %>
  </body>
</html>
